<!DOCTYPE html>
<html lang=en>
<head>
    <!-- so meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="HandheldFriendly" content="True">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="description" content="swagger ui和spring boot集成生成api文档java java 曾经一度我一直想在做前后端分离的时间写api接口是一个痛苦的过程，虽然也在网上找了一些可以填写api的系统，但使用起来总是不尽人意。现在，终于找到一款可以和api完美集成自动生成api文档加测试的工具，真是一件让人高兴的事呢。如果你也需要，那就好好看看这篇文章吧。 一、环境1. JAVA82. MAVEN 3.0.5">
<meta property="og:type" content="article">
<meta property="og:title" content="swaggerui和springboot集成生成api文档">
<meta property="og:url" content="http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/index.html">
<meta property="og:site_name" content="TmoonSite">
<meta property="og:description" content="swagger ui和spring boot集成生成api文档java java 曾经一度我一直想在做前后端分离的时间写api接口是一个痛苦的过程，虽然也在网上找了一些可以填写api的系统，但使用起来总是不尽人意。现在，终于找到一款可以和api完美集成自动生成api文档加测试的工具，真是一件让人高兴的事呢。如果你也需要，那就好好看看这篇文章吧。 一、环境1. JAVA82. MAVEN 3.0.5">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://image.xiaomo.info/swagger/swagger.png">
<meta property="article:published_time" content="2017-12-14T14:09:04.000Z">
<meta property="article:modified_time" content="2020-01-07T10:48:14.818Z">
<meta property="article:author" content="Tmoonlight">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://image.xiaomo.info/swagger/swagger.png">
    
    
        
          
              <link rel="shortcut icon" href="/images/favicon.ico">
          
        
        
          
            <link rel="icon" type="image/png" href="/images/logo2.gif" sizes="192x192">
          
        
        
          
            <link rel="apple-touch-icon" sizes="180x180" href="/images/logo2.gif">
          
        
    
    <!-- title -->
    <title>swaggerui和springboot集成生成api文档</title>
    <!-- styles -->
    
<link rel="stylesheet" href="/css/style.css">

    <!-- persian styles -->
    
      
<link rel="stylesheet" href="/css/rtl.css">

    
    <!-- rss -->
    
    
<meta name="generator" content="Hexo 4.2.0"></head>

<body class="max-width mx-auto px3 ltr">
    
      <div id="header-post">
  <a id="menu-icon" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="menu-icon-tablet" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="top-icon-tablet" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');" style="display:none;"><i class="fas fa-chevron-up fa-lg"></i></a>
  <span id="menu">
    <span id="nav">
      <ul>
         
          <li><a href="/">Home</a></li>
         
          <li><a href="/about/">About</a></li>
         
          <li><a href="/archives/">Writing</a></li>
         
          <li><a href="/projects_url">Projects</a></li>
        
      </ul>
    </span>
    <br/>
    <span id="actions">
      <ul>
        
        <li><a class="icon" href="/2017/12/28/jenkins%E6%97%A0%E6%95%88%E9%A9%B1%E5%8A%A8%E5%99%A8%E8%A7%84%E6%A0%BC/"><i class="fas fa-chevron-left" aria-hidden="true" onmouseover="$('#i-prev').toggle();" onmouseout="$('#i-prev').toggle();"></i></a></li>
        
        
        <li><a class="icon" href="/2017/12/05/StampQuote/"><i class="fas fa-chevron-right" aria-hidden="true" onmouseover="$('#i-next').toggle();" onmouseout="$('#i-next').toggle();"></i></a></li>
        
        <li><a class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up" aria-hidden="true" onmouseover="$('#i-top').toggle();" onmouseout="$('#i-top').toggle();"></i></a></li>
        <li><a class="icon" href="#"><i class="fas fa-share-alt" aria-hidden="true" onmouseover="$('#i-share').toggle();" onmouseout="$('#i-share').toggle();" onclick="$('#share').toggle();return false;"></i></a></li>
      </ul>
      <span id="i-prev" class="info" style="display:none;">Previous post</span>
      <span id="i-next" class="info" style="display:none;">Next post</span>
      <span id="i-top" class="info" style="display:none;">Back to top</span>
      <span id="i-share" class="info" style="display:none;">Share post</span>
    </span>
    <br/>
    <div id="share" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/" target="_blank" rel="noopener"><i class="fab fa-facebook " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&text=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-twitter " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&title=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-linkedin " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&is_video=false&description=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-pinterest " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=swaggerui和springboot集成生成api文档&body=Check out this article: http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/"><i class="fas fa-envelope " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&title=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-get-pocket " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&title=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-reddit " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&title=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-stumbleupon " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&title=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-digg " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&name=swaggerui和springboot集成生成api文档&description=" target="_blank" rel="noopener"><i class="fab fa-tumblr " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://news.ycombinator.com/submitlink?u=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&t=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-hacker-news " aria-hidden="true"></i></a></li>
</ul>

    </div>
    <div id="toc">
      <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#swagger-ui和spring-boot集成生成api文档"><span class="toc-number">1.</span> <span class="toc-text">swagger ui和spring boot集成生成api文档</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#一、环境"><span class="toc-number">1.0.1.</span> <span class="toc-text">一、环境</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1-JAVA8"><span class="toc-number">1.0.1.1.</span> <span class="toc-text">1. JAVA8</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-MAVEN-3-0-5"><span class="toc-number">1.0.1.2.</span> <span class="toc-text">2. MAVEN 3.0.5</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3-IDEA-2016-2-5"><span class="toc-number">1.0.1.3.</span> <span class="toc-text">3. IDEA 2016.2.5</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#4-spring-boot-1-4-1"><span class="toc-number">1.0.1.4.</span> <span class="toc-text">4. spring boot 1.4.1</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#二、相关依赖"><span class="toc-number">1.0.2.</span> <span class="toc-text">二、相关依赖</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#三、配置"><span class="toc-number">1.0.3.</span> <span class="toc-text">三、配置</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#四、相关注解解读"><span class="toc-number">1.0.4.</span> <span class="toc-text">四、相关注解解读</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1-Api"><span class="toc-number">1.0.4.1.</span> <span class="toc-text">1. @Api</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-ApiOperation"><span class="toc-number">1.0.4.2.</span> <span class="toc-text">2. @ApiOperation</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3-ApiImplicitParams"><span class="toc-number">1.0.4.3.</span> <span class="toc-text">3 @ApiImplicitParams</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#4-ApiImplicitParam"><span class="toc-number">1.0.4.4.</span> <span class="toc-text">4. @ApiImplicitParam</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#5-ApiResponses"><span class="toc-number">1.0.4.5.</span> <span class="toc-text">5. @ApiResponses</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#6-ApiResponse"><span class="toc-number">1.0.4.6.</span> <span class="toc-text">6. @ApiResponse</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#7-ApiModel"><span class="toc-number">1.0.4.7.</span> <span class="toc-text">7. @ApiModel</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#8-ApiModelProperty"><span class="toc-number">1.0.4.8.</span> <span class="toc-text">8. @ApiModelProperty</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#五、-和Swagger-UI的集成"><span class="toc-number">1.0.4.9.</span> <span class="toc-text">五、 和Swagger UI的集成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#六、访问"><span class="toc-number">1.0.4.10.</span> <span class="toc-text">六、访问</span></a></li></ol></li></ol></li></ol></li></ol>
    </div>
  </span>
</div>

    
    <div class="content index py4">
        
        <article class="post" itemscope itemtype="http://schema.org/BlogPosting">
  <header>
    
    <h1 class="posttitle" itemprop="name headline">
        swaggerui和springboot集成生成api文档
    </h1>



    <div class="meta">
      <span class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">
        <span itemprop="name">TmoonSite</span>
      </span>
      
    <div class="postdate">
      
        <time datetime="2017-12-14T14:09:04.000Z" itemprop="datePublished">2017-12-14</time>
        
      
    </div>


      

      

    </div>
  </header>
  

  <div class="content" itemprop="articleBody">
    <h1 id="swagger-ui和spring-boot集成生成api文档"><a href="#swagger-ui和spring-boot集成生成api文档" class="headerlink" title="swagger ui和spring boot集成生成api文档"></a>swagger ui和spring boot集成生成api文档</h1><p><a href="https://blog.xiaomo.info/categories/java/" target="_blank" rel="noopener">java</a></p>
<p><a href="https://blog.xiaomo.info/tags/java/" target="_blank" rel="noopener">java</a></p>
<p>曾经一度我一直想在做前后端分离的时间写api接口是一个痛苦的过程，虽然也在网上找了一些可以填写api的系统，但使用起来总是不尽人意。现在，终于找到一款可以和api完美集成自动生成api文档加测试的工具，真是一件让人高兴的事呢。如果你也需要，那就好好看看这篇文章吧。</p>
<h3 id="一、环境"><a href="#一、环境" class="headerlink" title="一、环境"></a>一、环境</h3><h4 id="1-JAVA8"><a href="#1-JAVA8" class="headerlink" title="1. JAVA8"></a>1. JAVA8</h4><h4 id="2-MAVEN-3-0-5"><a href="#2-MAVEN-3-0-5" class="headerlink" title="2. MAVEN 3.0.5"></a>2. MAVEN 3.0.5</h4><h4 id="3-IDEA-2016-2-5"><a href="#3-IDEA-2016-2-5" class="headerlink" title="3. IDEA 2016.2.5"></a>3. IDEA 2016.2.5</h4><h4 id="4-spring-boot-1-4-1"><a href="#4-spring-boot-1-4-1" class="headerlink" title="4. spring boot 1.4.1"></a>4. spring boot 1.4.1</h4><h3 id="二、相关依赖"><a href="#二、相关依赖" class="headerlink" title="二、相关依赖"></a>二、相关依赖</h3><dependency>

<p><groupId>io.springfox</groupId></p>
<p><artifactId>springfox-swagger-ui</artifactId></p>
<p><version>2.8.0</version></p>
</dependency>




<dependency>

<p><groupId>io.springfox</groupId></p>
<p><artifactId>springfox-swagger2</artifactId></p>
<p><version>2.8.0</version></p>
</dependency>

<p>| </p>
<p>| </p>
<p>| </p>
<p>—|—|—|—  </p>
<h3 id="三、配置"><a href="#三、配置" class="headerlink" title="三、配置"></a>三、配置</h3><p>设置了一些默认显示的api相关信息，最后上截图的时就可以比较清楚的看到。</p>
<p>@Configuration</p>
<p>@EnableSwagger2</p>
<p>public class SwaggerConfiguration{</p>
<p>@Bean</p>
<p>public Docket createRestApi() {</p>
<p>return new Docket(DocumentationType.SWAGGER_2)</p>
<p>.apiInfo(apiInfo())</p>
<p>.select()</p>
<p>.apis(RequestHandlerSelectors.basePackage(“info.xiaomo.website”))</p>
<p>.paths(PathSelectors.any())</p>
<p>.build();</p>
<p>}</p>
<p>private ApiInfo apiInfo() {</p>
<p>return new ApiInfoBuilder()</p>
<p>.title(“Spring Boot中使用Swagger2构建RESTful APIs”)</p>
<p>.description(“api根地址：<a href="http://api.xiaomo.info:8080/" target="_blank" rel="noopener">http://api.xiaomo.info:8080/</a>“)</p>
<p>.termsOfServiceUrl(“<a href="https://xiaomo.info/" target="_blank" rel="noopener">https://xiaomo.info/</a>“)</p>
<p>.contact(“小莫”)</p>
<p>.version(“1.0”)</p>
<p>.build();</p>
<p>}</p>
<p>}</p>
<p>| </p>
<p>| </p>
<p>| </p>
<p>| </p>
<p>| </p>
<p>—|—|—|—|—|—  </p>
<h3 id="四、相关注解解读"><a href="#四、相关注解解读" class="headerlink" title="四、相关注解解读"></a>四、相关注解解读</h3><h4 id="1-Api"><a href="#1-Api" class="headerlink" title="1. @Api"></a>1. @Api</h4><p>用在类上，说明该类的作用</p>
<p>@Api(value = “UserController”, description = “用户相关api”)</p>
<h4 id="2-ApiOperation"><a href="#2-ApiOperation" class="headerlink" title="2. @ApiOperation"></a>2. @ApiOperation</h4><p>用在方法上，说明方法的作用</p>
<p>@ApiOperation(value = “查找用户”, notes = “查找用户”, httpMethod = “GET”, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)</p>
<h4 id="3-ApiImplicitParams"><a href="#3-ApiImplicitParams" class="headerlink" title="3 @ApiImplicitParams"></a>3 @ApiImplicitParams</h4><p>用在方法上包含一组参数说明</p>
<h4 id="4-ApiImplicitParam"><a href="#4-ApiImplicitParam" class="headerlink" title="4. @ApiImplicitParam"></a>4. @ApiImplicitParam</h4><p>用在@ApiImplicitParams注解中，指定一个请求参数的各个方面</p>
<p>paramType：参数放在哪个地方</p>
<p>header–&gt;请求参数的获取：@RequestHeader</p>
<p>query–&gt;请求参数的获取：@RequestParam</p>
<p>path（用于restful接口）–&gt;请求参数的获取：@PathVariable</p>
<p>body（不常用）</p>
<p>form（不常用）</p>
<p>name：参数名</p>
<p>dataType：参数类型</p>
<p>required：参数是否必须传</p>
<p>value：参数的意思</p>
<p>defaultValue：参数的默认值</p>
<p>@ApiImplicitParams({</p>
<p>@ApiImplicitParam(name = “id”, value = “唯一id”, required = true, dataType = “Long”, paramType = “path”),</p>
<p>})</p>
<p>| </p>
<p>| </p>
<p>| </p>
<p>| </p>
<p>| </p>
<p>| </p>
<p>| </p>
<p>—|—|—|—|—|—|—|—  </p>
<h4 id="5-ApiResponses"><a href="#5-ApiResponses" class="headerlink" title="5. @ApiResponses"></a>5. @ApiResponses</h4><p>用于表示一组响应</p>
<h4 id="6-ApiResponse"><a href="#6-ApiResponse" class="headerlink" title="6. @ApiResponse"></a>6. @ApiResponse</h4><p>用在@ApiResponses中，一般用于表达一个错误的响应信息</p>
<p>code：数字，例如400</p>
<p>message：信息，例如”请求参数没填好”</p>
<p>response：抛出异常的类</p>
<p>@ApiResponses(value = {</p>
<p>@ApiResponse(code = 400, message = “No Name Provided”)</p>
<p>})</p>
<p>| </p>
<p>| </p>
<p>| </p>
<p>| </p>
<p>—|—|—|—|—  </p>
<h4 id="7-ApiModel"><a href="#7-ApiModel" class="headerlink" title="7. @ApiModel"></a>7. @ApiModel</h4><p>描述一个Model的信息（这种一般用在post创建的时候，使用@RequestBody这样的场景，请求参数无法使用@ApiImplicitParam注解进行描述的时候）</p>
<p>@ApiModel(value = “用户实体类”)</p>
<h4 id="8-ApiModelProperty"><a href="#8-ApiModelProperty" class="headerlink" title="8. @ApiModelProperty"></a>8. @ApiModelProperty</h4><p>描述一个model的属性</p>
<p>@ApiModelProperty(value = “登录用户”)</p>
<h4 id="五、-和Swagger-UI的集成"><a href="#五、-和Swagger-UI的集成" class="headerlink" title="五、 和Swagger UI的集成"></a>五、 和Swagger UI的集成</h4><p>首先，从github <a href="https://github.com/swagger-api/swagger-ui" target="_blank" rel="noopener">swagger-ui</a> 上下载Swagger-UI, 把该项目dist目录下的内容拷贝到项目的resources的目录public下。</p>
<h4 id="六、访问"><a href="#六、访问" class="headerlink" title="六、访问"></a>六、访问</h4><p><a href="http://localhost:8080/swagger-ui.html" target="_blank" rel="noopener">http://localhost:8080/swagger-ui.html</a> 就可以看到效果如下</p>
<p><a href="https://image.xiaomo.info/swagger/swagger.png" target="_blank" rel="noopener"><img src="https://image.xiaomo.info/swagger/swagger.png" alt=""></a></p>

  </div>
</article>



        
          <div id="footer-post-container">
  <div id="footer-post">

    <div id="nav-footer" style="display: none">
      <ul>
         
          <li><a href="/">Home</a></li>
         
          <li><a href="/about/">About</a></li>
         
          <li><a href="/archives/">Writing</a></li>
         
          <li><a href="/projects_url">Projects</a></li>
        
      </ul>
    </div>

    <div id="toc-footer" style="display: none">
      <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#swagger-ui和spring-boot集成生成api文档"><span class="toc-number">1.</span> <span class="toc-text">swagger ui和spring boot集成生成api文档</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#一、环境"><span class="toc-number">1.0.1.</span> <span class="toc-text">一、环境</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1-JAVA8"><span class="toc-number">1.0.1.1.</span> <span class="toc-text">1. JAVA8</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-MAVEN-3-0-5"><span class="toc-number">1.0.1.2.</span> <span class="toc-text">2. MAVEN 3.0.5</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3-IDEA-2016-2-5"><span class="toc-number">1.0.1.3.</span> <span class="toc-text">3. IDEA 2016.2.5</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#4-spring-boot-1-4-1"><span class="toc-number">1.0.1.4.</span> <span class="toc-text">4. spring boot 1.4.1</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#二、相关依赖"><span class="toc-number">1.0.2.</span> <span class="toc-text">二、相关依赖</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#三、配置"><span class="toc-number">1.0.3.</span> <span class="toc-text">三、配置</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#四、相关注解解读"><span class="toc-number">1.0.4.</span> <span class="toc-text">四、相关注解解读</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#1-Api"><span class="toc-number">1.0.4.1.</span> <span class="toc-text">1. @Api</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-ApiOperation"><span class="toc-number">1.0.4.2.</span> <span class="toc-text">2. @ApiOperation</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#3-ApiImplicitParams"><span class="toc-number">1.0.4.3.</span> <span class="toc-text">3 @ApiImplicitParams</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#4-ApiImplicitParam"><span class="toc-number">1.0.4.4.</span> <span class="toc-text">4. @ApiImplicitParam</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#5-ApiResponses"><span class="toc-number">1.0.4.5.</span> <span class="toc-text">5. @ApiResponses</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#6-ApiResponse"><span class="toc-number">1.0.4.6.</span> <span class="toc-text">6. @ApiResponse</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#7-ApiModel"><span class="toc-number">1.0.4.7.</span> <span class="toc-text">7. @ApiModel</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#8-ApiModelProperty"><span class="toc-number">1.0.4.8.</span> <span class="toc-text">8. @ApiModelProperty</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#五、-和Swagger-UI的集成"><span class="toc-number">1.0.4.9.</span> <span class="toc-text">五、 和Swagger UI的集成</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#六、访问"><span class="toc-number">1.0.4.10.</span> <span class="toc-text">六、访问</span></a></li></ol></li></ol></li></ol></li></ol>
    </div>

    <div id="share-footer" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/" target="_blank" rel="noopener"><i class="fab fa-facebook fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&text=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-twitter fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&title=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-linkedin fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&is_video=false&description=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-pinterest fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=swaggerui和springboot集成生成api文档&body=Check out this article: http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/"><i class="fas fa-envelope fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&title=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-get-pocket fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&title=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-reddit fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&title=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-stumbleupon fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&title=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-digg fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&name=swaggerui和springboot集成生成api文档&description=" target="_blank" rel="noopener"><i class="fab fa-tumblr fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://news.ycombinator.com/submitlink?u=http://yoursite.com/2017/12/14/swaggerui%E5%92%8Cspringboot%E9%9B%86%E6%88%90%E7%94%9F%E6%88%90api%E6%96%87%E6%A1%A3/&t=swaggerui和springboot集成生成api文档" target="_blank" rel="noopener"><i class="fab fa-hacker-news fa-lg" aria-hidden="true"></i></a></li>
</ul>

    </div>

    <div id="actions-footer">
        <a id="menu" class="icon" href="#" onclick="$('#nav-footer').toggle();return false;"><i class="fas fa-bars fa-lg" aria-hidden="true"></i> Menu</a>
        <a id="toc" class="icon" href="#" onclick="$('#toc-footer').toggle();return false;"><i class="fas fa-list fa-lg" aria-hidden="true"></i> TOC</a>
        <a id="share" class="icon" href="#" onclick="$('#share-footer').toggle();return false;"><i class="fas fa-share-alt fa-lg" aria-hidden="true"></i> Share</a>
        <a id="top" style="display:none" class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up fa-lg" aria-hidden="true"></i> Top</a>
    </div>

  </div>
</div>

        
        <footer id="footer">
  <div class="footer-left">
    Copyright &copy; 2020 Tmoonlight
  </div>
  <div class="footer-right">
    <nav>
      <ul>
         
          <li><a href="/">Home</a></li>
         
          <li><a href="/about/">About</a></li>
         
          <li><a href="/archives/">Writing</a></li>
         
          <li><a href="/projects_url">Projects</a></li>
        
      </ul>
    </nav>
  </div>
</footer>

    </div>
    <!-- styles -->

<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">


<link rel="stylesheet" href="/lib/justified-gallery/css/justifiedGallery.min.css">


    <!-- jquery -->

<script src="/lib/jquery/jquery.min.js"></script>


<script src="/lib/justified-gallery/js/jquery.justifiedGallery.min.js"></script>

<!-- clipboard -->

  
<script src="/lib/clipboard/clipboard.min.js"></script>

  <script type="text/javascript">
  $(function() {
    // copy-btn HTML
    var btn = "<span class=\"btn-copy tooltipped tooltipped-sw\" aria-label=\"Copy to clipboard!\">";
    btn += '<i class="far fa-clone"></i>';
    btn += '</span>'; 
    // mount it!
    $(".highlight table").before(btn);
    var clip = new ClipboardJS('.btn-copy', {
      text: function(trigger) {
        return Array.from(trigger.nextElementSibling.querySelectorAll('.code')).reduce((str,it)=>str+it.innerText+'\n','')
      }
    });
    clip.on('success', function(e) {
      e.trigger.setAttribute('aria-label', "Copied!");
      e.clearSelection();
    })
  })
  </script>


<script src="/js/main.js"></script>

<!-- search -->

<!-- Google Analytics -->

<!-- Baidu Analytics -->

<!-- Disqus Comments -->


</body>
</html>
